package org.lboot.flow.module.assign.validator;

import org.lboot.flow.constant.FlowAssignConst;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class IsAssignTypeValidator implements ConstraintValidator<IsAssignType, String> {

    @Override
    public void initialize(IsAssignType constraintAnnotation) {
        ConstraintValidator.super.initialize(constraintAnnotation);
    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if (s.equals(FlowAssignConst.DEPT) || s.equals(FlowAssignConst.ROLE) || s.equals(FlowAssignConst.USER) || s.equals(FlowAssignConst.SELF)){
            return true;
        }
        return false;
    }
}